<!--
 * @Author: Wulala
 * @Date: 2025-03-24 16:15:19
 * @LastEditTime: 2025-04-21 15:04:55
 * @LastEditors: Wulala
 * @Description: 
 * @FilePath: \exchange\app\admin\view\index\app_list.html
 * 可以输入预定的版权声明、个性签名、空行等
-->
 <style>
    body{
        /* width:100%; */
        background-color: #f3f3f3;
        /* background-image: url('/static/admin/images/loginbg.png'); */
        background-repeat: no-repeat; /* 不重复 */
    }
    .app-box{
        width:100%;
    }
    .app-block{
      width:85%;
      background-color: #ffffff;
      padding: 50px;
      margin: 0 auto;
      display: grid;
      grid-template-columns: 1fr 1fr 1fr;
      grid-gap:20px;
    }
    .item{
        /* width: 20rem; */
        height: 150px;
        background-color: #fff;
        padding: 20px;
        box-sizing:border-box;
        border-radius: 10px;
        position: relative;
        box-shadow: -10px 0px 15px -5px rgba(0,0,0,0.1), /* 左侧阴影 */
              10px 0px 15px -5px rgba(0,0,0,0.1), /* 右侧阴影 */
              0px -10px 15px -5px rgba(0,0,0,0.1), /* 上侧阴影 */
              0px 10px 15px -5px rgba(0,0,0,0.1); /* 下侧阴影 */
    }
    .jia img{
        width: 60px;
        height:60px ;
        margin: 20px 50px 0px 50px;
    }
    p{
        /* text-align: center; */
        /* margin-top: 25px; */
        font-size: 16px;
    }
    .app-top{
       /* width: 100%; */
       height: 40px;
       background-color: #000;
       padding: 0 50px;
       display: flex;
       justify-content: space-between;
    }
    .app-top span{
       /* float: right; */
       color: #fff;
       line-height: 40px;
    }
    .add-btn{
        position: absolute;
        right: 25px; 
        bottom: 15px;
        border-radius: 25px;
        background-color: #16C4AF;
    }
 </style>

<div class="app-top">
    <span>你好,{$username}</span>
    <span class="login-out">退出</span>
</div>

 <div class="app-box">
    <div class="app-block">
       
        <div class="item jia">
            <a href="/admin/index/appListSet?appid={$v.appid??''}&type=2" style="display: flex;justify-content: center;flex-wrap :wrap">
                <div style="width: 100%;display: flex;justify-content: center;">
                    <img src="\static\admin\images\jia.png">
                </div>
                <p style="color: #16C4AF;">新建应用</p>
            </a>
        </div>
       
        {foreach $data as $v}
        <div class="item">
            <p>{$v.app_name}</p>
            <!-- <img src="{$v.app_img}"> -->     
            <a href="/admin/index/appListSet?appid={$v.appid}&type=1">
               <button type="button" class="layui-btn layui-btn-normal layui-btn-sm add-btn">进入应用</button>
            </a>
        </div>
        {/foreach}

    </div>    
 </div>

<script src="/static/common/js/jquery-1.10.1.min.js"></script>

<script>
    layui.use(['form', 'layer'], function() {
        form = layui.form,
        layer = layui.layer,

        // $('.login-out').on("click", function () {
        //         ea.request.get({
        //             url: 'login/out',
        //             prefix: true,
        //         }, function (res) {
        //             ea.msg.success(res.msg, function () {
        //                 window.location = ea.url('login/index');
        //             })
        //         });
        //     });

        //监听提交
        $('.login-out').on("click", function(data){
            $.ajax({
                url:'/admin/login/out',
                type:'POST',
                success:function(result){
                    if (result.code == 1) {
                        layer.alert(result.msg, {icon: 1});
                        setTimeout(function(){
                            window.location = '/admin/login/index';
                        },2000)
                    }else{
                        layer.alert(result.msg, {icon: 2});
                    }
                },
                error:function (res) {
                    layer.alert(result.msg, {icon: 2});
                }
            });

            return false;
        })

    })
</script>
